package com.lsw.jgyf.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by lsw on 2016/11/22.
 */
public class FragmentViewPagerAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragmentList;
    private List<String> mTitleList;

    public FragmentViewPagerAdapter(FragmentManager fm, List<Fragment> fragmentList, List<String> mTitleList) {
        super(fm);
        this.fragmentList = fragmentList;
        this.mTitleList = mTitleList;
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }


    @Override
    public long getItemId(int position) {
        return position;
    }


    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitleList.get(position);//页卡标题
    }

}

